<template>
  <div class="like">
    <Card>
      <span>猜你喜欢</span>
    </Card>
    <ul>
      <li
        v-for="(item, index) in likeList"
        :key="index"
        @click="goDetail(item.id)"
      >
        <h2><img :src="item.imgUrl" alt="" /></h2>
        <h3>{{ item.name }}</h3>
        <div>
          <span>￥</span>
          <b>{{ item.price }}</b>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import Card from "@/components/home/Card.vue";
export default {
  props: {
    likeList: Array,
  },
  components: { Card },
  methods: {
    goDetail(id) {
      this.$router.push({
        path: "/detail",
        query: {
          id,
        },
      });
    },
  },
};
</script>

<style scoped>
.like ul {
  display: flex;
  flex-wrap: wrap;
}
.like ul li {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 50%;
}
.like ul li > div {
  padding: 6px;
  width: 90%;
  text-align: left;
  color: #cc0e0e;
  margin-bottom: 10px;
}
.like ul li > div span {
  font-size: 16px;
}
.like ul li > div b {
  font-size: 20px;
}
.like h3 {
  width: 90%;
  font-size: 16px;
  font-weight: 400;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.like img {
  width: 175px;
  height: 175px;
}
</style>
